<template>
<uni-shadow-root class="yg-web-view-yg-web-view"><view class="container">
    <web-view :src="url" @load="loadSuc" @error="loadError">
    </web-view>
</view></uni-shadow-root>
</template>

<script>

global['__wxVueOptions'] = {components:{}}

global['__wxRoute'] = 'yg-web-view/yg-web-view'
//自定义控件
Component({

    properties: {
        //加载地址
        url: {
            type: String
        }
    },

    data: {

    },

    methods: {

        /**
         * 网页加载成功
         */
        loadSuc(event) {
            if (getApp().globalData.ygPlugin && getApp().globalData.ygPlugin.report) {
                getApp().globalData.ygPlugin.report('load-ad-page', 'load page[initUrl:' + this.properties.url + '   ,   curUrl:' + event.detail.src + '] suc');
            }
        },

        /**
         * 网页加载错误
         * @param {Object} error 错误信息
         */
        loadError(event) {
            if (getApp().globalData.ygPlugin && getApp().globalData.ygPlugin.reportError) {
                getApp().globalData.ygPlugin.reportError('load-ad-page', 'load page[initUrl:' + this.properties.url + '   ,   curUrl:' + event.detail.url + '] error: ' + event.detail.errMsg);
            }
        },
    }
})
export default global['__wxComponents']['yg-web-view/yg-web-view']
</script>
<style platform="mp-weixin">
.container {
    width: 100%;
    height: 100%;
}

.cover {
    width: 100%;
    height: 100%;
    background-color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: 0;
    top: 0;
}

.info {
    color: black;
    font-size: 26rpx;
    margin-left: 50rpx;
    margin-right: 50rpx;
    line-height: 30rpx;
}

.reload {
    height: 70rpx;
    color: white;
    margin-top: 40rpx;
    font-size: 30rpx;
    padding-left: 20rpx;
    padding-right: 20rpx;
    background-color: #04C160;
    border-radius: 10rpx;
    line-height: 70rpx;
}
</style>